<?php
//patikrinam ar teisingai uzkrautas puslapis
if (!defined("OK")) { header('location: ?'); exit; }
unset($extra);

//$timeout = (time() - 300);
//echo $timeout;
if (defined("LEVEL") && LEVEL >= 30) { //ADMINAS
	$q = "SELECT * FROM ".LENTELES_PRIESAGA."kas_prisijunges WHERE `timestamp`>'".$timeout."'";
}
elseif (!defined("LEVEL")) { //SVECIAS
	$q = "SELECT `id`, `uid`, `file`, `user`, `clicks`, `timestamp` FROM ".LENTELES_PRIESAGA."kas_prisijunges WHERE `timestamp`>'".$timeout."' LIMIT 10";
}
else { //USERIS
	$q = "SELECT `id`, `uid`, `user`, `clicks`, `file`, `timestamp` FROM ".LENTELES_PRIESAGA."kas_prisijunges WHERE `timestamp`>'".$timeout."' ORDER BY `clicks` ASC LIMIT 50";
}

$result=mysql_query1($q) or die(klaida("Klaida",mysql_error()));
$u = mysql_num_rows($result); $i = 0;

	while ($row = mysql_fetch_assoc($result)) {
		//if (!empty($row['user'])) {
			$info[$i] = array(
				"Slapyvardis" => "<a href='?id,47;m,".$row['id']."' title='".$row['user']."'>".$row['user']."</a>",
				"Nekvėpuoja" => date('i:s',$timestamp-$row['timestamp']),
				"Spaudelioja" => $row['clicks']
			);
			if (defined("LEVEL") && LEVEL >= 30) {
					$info[$i]['IP'] = "<a href='http://www.dnsstuff.com/tools/whois.ch?ip=".$row['ip']."&src=ShowIP' target='_blank' title='".$row['ip']."'>".$row['ip']."</a>";
					$info[$i]['Puslapyje'] = '<a href="?'.$row['file'].'"><img src="images/icons/link.png" alt="page" border="0" class="middle"/></a>';
					$info[$i]['Naršyklė'] = "<a href='http://user-agent-string.info/?action=analyze&Fuas=".urlencode($row['agent'])."' target='_blank' title=\"header=[User Agent] body=[<br/><center>User Agent: ".$row['agent']." <br/><br/>] fade=[on]\">".trimlink(get_browser_info($row['agent']),30)."</a>";
					$info[$i]['OS'] = get_user_os();
			}
		$i++;
	}

	include_once("priedai/class.php");
	$bla = new Table();
	lentele("Prisijungę vartotojai - ".$u,$bla->render($info));

	mysql_free_result($result);
	//unset($user,$nekvepuoja,$file,$img,$content,$i,$u,$q,$row,$extra);

?>